#ifndef __SCENE_MANAGER_HPP__
#define __SCENE_MANAGER_HPP__

class BaseEntity;
class LevelSector;

#include <vector>
#include <map>
#include <time.h>

class SceneManager
{
public:
	static SceneManager* GetInstance();
	
	// Update and render entities.
	void                 UpdateScene(clock_t tick);

	// Registering entity in SceneManager.
	void                 RegisterEntity(BaseEntity* newEntity);

	// Unregister entity specified by entityID.
	// It should be destroyed on next UpdateScene invocation.
	void                 UnregisterEntity(int entityID);

	// Unregister all entities.
	void                 UnregisterAllEntities();

	// Get entity under current ID.
	BaseEntity*          GetEntityByID(int& entityID);

	// Add sector to sector list.
	void                 pushSector(LevelSector* pSector);

	void                 setPlayer(BaseEntity* pPlayer);

	void                 getDynamicIDS(std::vector<int>* pVec);

private:
	SceneManager();

	int                      GenerateUniqueID() { return ++m_idIndex; };

	static SceneManager*        m_instance;
	BaseEntity*                 m_pPlayer;
	std::vector<int>            m_entitiesToDestroy;
	std::vector<LevelSector*>   m_levelSectors;
	std::map<int, BaseEntity*>  m_entitiesMap;
	int                         m_idIndex;
	clock_t                     m_startTick;
	clock_t                     m_lastFrameTick;
	long                        m_numOfFrames;
};

#endif //__SCENE_MANAGER_HPP__

//EOF